{
Alisa_Barkar
11/10/12
}
program Spisok2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

type
  pelement=^element;
  element=record
    value:integer;
    next:pelement;
  end;
function  DeleteFromBegin (var head:pelement):integer;
var
  tmp:pelement;
begin
  if (head<> nil) then
  begin
    tmp:=head^.next;
    DeleteFromBegin:=head^.value;
    dispose (head);
    head:=tmp;
  end;
end;
procedure AddToBegin (var head:pelement; num:integer);
var
  tmp:pelement;
begin
  tmp:=head;
  new(head);
  head^.value:=num;
  head^.next:=tmp;
end;
procedure PrintList (head:pelement);
var
  current:pelement;
begin
  current:=head;
  while (current<>nil) do
  begin
    writeln (current^.value);
    current:=current^.next;
  end;
end;

var
  mass: array of integer;
  n, i:integer;
  head:pelement;
  fin:textFile;
begin
  new(head);
  assign (fin, 'input.txt');
  reset (fin);
  readln (fin, n);
  setlength(mass, n);
  for i:=0 to n-1 do
    readln(fin, mass[i]);
  closeFile (fin);
  for i:=n-1 downto 0 do
    AddToBegin (head, mass[i]);
  PrintList (head);
  for i:=n-1 downto 0 do
    DeleteFromBegin (head);
  readln;
end.
